<?php

namespace IDock\Insurance\ZYIC\Response;

use IDock\Http\Response;
use IDock\IDock\IDock;
use IDock\IDock\IDockEnums;
use IDock\Insurance\ZYIC\Response\AllZYICResponse;
use IDock\Printer\ProposalStatusPrinter;

class UnderwritingReasonResponse extends AllZYICResponse
{

    /**
     * @var ProposalStatusPrinter $printer
     */
    public $printer = ProposalStatusPrinter::class;

    public function printerInit(): Response
    {

        $data = $this->getBody()['content'] ?? [];
        $lastOne = end($data);

        $this->printer->messageTip = ($lastOne['flowStatus'] ?? '').' '.($lastOne['handleText'] ?? '');
        $this->printer->statusCode = 'U4';
        $this->printer->status = IDockEnums::$underStats[$this->printer->statusCode] ?? '';
        return $this;
    }
}
